// 影厅--服务层
const theatersDao = require("../dao/theatersDao")

const addData= async(data)=>{//添加影厅数据
    var {cinemasId,name}=data;
    const result=await theatersDao.isHaveTheater({cinemasId,name});
    if (result.length==0) {
        return await theatersDao.addData(data)
    }else{
        return false;
    }
}
    
const getCinemas=async()=>{return await theatersDao.getCinemas()};//请求影院数据
const getTheaters=async()=>{return await theatersDao.getTheaters()};//请求影厅数据
const remove=async(data)=>{return await theatersDao.remove(data)};//删除影厅数据
const updateOne=async(_id,data)=>{return await theatersDao.updateOne(_id,data)};//更改影厅数据

module.exports = {addData,getCinemas,getTheaters,remove,updateOne}